package com.kuiandjie.web;


import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.kuiandjie.entity.Employee;
import com.kuiandjie.entity.Project;
import com.kuiandjie.service.ProjectService;

public class MainServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		HttpSession session = request.getSession();
		
		//获取当前登录对象id对应的所有项目
		Employee em = (Employee) session.getAttribute("employee");
		
		ProjectService ps = new ProjectService();
		List<Project> proList = ps.getAllProByEmployeeId(em.getId());
		request.setAttribute("proList", proList);
		
		request.getRequestDispatcher("WEB-INF/views/main.jsp").forward(request, response);
	}
}
